<template>
  <div class="divBox relative">
    <el-card class="box-card">
      <div slot="header" class="clearfix">

      </div>
      <el-table
        v-loading="listLoading"
        :data="tableData.data"
        style="width: 100%"
        size="mini"
        :highlight-current-row="true"
        :header-cell-style=" {fontWeight:'bold'}"
      >
        <el-table-column
          prop="id"
          label="ID"
          min-width="50"
        />

        <el-table-column
          prop="dpName"
          label="店铺名称"
          min-width="90"
          align="center"
        />
        <el-table-column
          prop="dpRegion"
          label="店铺所属区域"
          min-width="90"
          align="center"
        />
        <el-table-column
          prop="dpAddress"
          label="店铺详细地址"
          min-width="90"
          align="center"
        />
        <el-table-column
          prop="dpSpecies"
          label="店铺种类"
          min-width="70"
          align="center"
        />
        <el-table-column
          label="状态"
          min-width="80"
          fixed="right"
          prop="dpStatus"
        >
              <template slot-scope="scope">
                <span v-if="scope.row.dpStatus === 0">待审核</span>
                <span v-else-if="scope.row.dpStatus === 1">审核通过</span>
                <span v-else>审核未通过</span>
              </template>
        </el-table-column>
        <el-table-column label="操作" min-width="150" fixed="right" align="center">
          <template slot-scope="scope">
              <el-button @click="shenhe(scope.row.id)" type="text" size="small" class="mr10" v-hasPermi="['admin:product:info']">审核</el-button>
        </template>
        </el-table-column>
      </el-table>
      <div class="block">
        <el-pagination
          :page-sizes="[20, 40, 60, 80]"
          :page-size="tableFrom.limit"
          :current-page="tableFrom.page"
          layout="total, sizes, prev, pager, next, jumper"
          :total="tableData.total"
          @size-change="handleSizeChange"
          @current-change="pageChange"
        />
      </div>
    </el-card>
    <!--详情-->
    <details-from ref="adoptShopDetail" :id="id"/>
  </div>
</template>id

<script>
import { adoptShopDPInfo } from '@/api/adoptShop'
import { getToken } from '@/utils/auth'
import detailsFrom from './adoptShopDetail'
import { checkPermi } from "@/utils/permission"; // 权限判断函数
export default {
  name: 'AdoptShopList',
  //components: { taoBao },
  components: {
    detailsFrom
  },
  data() {
    return {

      listLoading: true,
      tableData: {
        data: [],
        total: 0
      },
      tableFrom: {
        page: 1,
        limit: 20,
        cateId: '',
        keywords: '',
        type: '1'
      }
    }
  },
  mounted() {
    this.getList()
    },
  methods: {
    checkPermi,

    seachList() {
      this.tableFrom.page = 1
      this.getList()
    },
    handleClose() {
      this.dialogVisible = false
    },
    handleCloseMod(item){
      this.dialogVisible = item
      this.getList();
    },
    // 列表
    getList() {
      this.listLoading = true
      adoptShopDPInfo(this.tableFrom).then(res => {
        console.log("list=",res);
        this.tableData.data = res
        this.tableData.total = res.total
        this.listLoading = false
      }).catch(res => {
        this.listLoading = false
        this.$message.error(res.message)
      })
    },
    pageChange(page) {
      this.tableFrom.page = page
      this.getList()
    },
    handleSizeChange(val) {
      this.tableFrom.limit = val
      this.getList()
    },
    shenhe(id){
      this.id = id
      this.$refs.adoptShopDetail.getAdoptShopDetail(id)
      this.$refs.adoptShopDetail.dialogVisible = true
    }
  }
}
</script>

<style scoped lang="scss">
   .el-table__body {
    width: 100%;
    table-layout: fixed !important;
  }
  .taoBaoModal{
  //  z-index: 3333 !important;
  }
  .demo-table-expand{
    ::v-deep label{
      width: 82px;
    }
  }
  .demo-table-expand{
    ::v-deep .el-form-item__content{
      width: 77%;
    }
  }
  .selWidth{
    width: 350px !important;
  }
  .seachTiele{
    line-height: 30px;
  }
  .relative{
    position: relative;
  }
</style>
